1. Field of the Invention
The present invention relates to a method of dynamically allocating a thread stack in a multi-threaded operating system, and more particularly, to a method of dynamically allocating a thread stack in a multi-threaded operating system of an embedded system for wireless sensor nodes.
The present invention has been produced from the work supported by the IT R&D program of MIC (Ministry of Information and Communication)/IITA (Institute for Information Technology Advancement) [2006-S-085-01, Nano OS for Automobile Sensor Nodes]
2. Discussion of Related Art
A wireless sensor networks include hundreds or thousands of wireless sensor nodes. These wireless sensor nodes collect information and process the information to communicate with neighboring nodes. Generally, a wireless sensor node includes with a small amount of memory (such as 2 KB to 10 KB), without a memory hardware protection device, i.e., a Memory Management Unit (MMU), because of low power and low cost. However, to perform multiple tasks in parallel in the memory-restricted embedded system, a multi-threaded operating system is needed.
In general, in the multi-threaded operating system, thread stacks are statically allocated in a memory space. In a static allocating method, a stack space to be used by the corresponding thread when a thread is generated is statically allocated and is not changed when a program is executed. Therefore, when the stack space allocated to the thread is partially used, this causes waste of memory in the remaining space. Also, in this method, a thread that requires more stack memory cannot use the memory, and thus a problem such as a stack overflow frequently occurs.
In view of this drawback, while a method of allocating a thread stack based on source code analysis has been suggested, the source code analysis is very complicated and takes too much time.